export const setUser = async (data) => {
  data.isLogin = true;
  localStorage.setItem('user', JSON.stringify(data));
}

export const getUser = () => {
  const user = localStorage.getItem('user');
  return user? JSON.parse(user) : null;
}

export const logout = () => {
  localStorage.removeItem('user');
}

export const updateUser = async (data) => {
  const user = getUser();
  user.userInfo = data;
  user.isLogin = true;
  localStorage.setItem('user', JSON.stringify(user));
}
